#include <bits/stdc++.h>
#define ll long long 
using namespace std;
const int MAXN = 1e5 + 5;
inline void File_Read() {
#ifdef DEBUG
    freopen("in.txt", "r", stdin);
//    freopen("out2.txt", "w", stdout); 
#else 
    freopen("shuliec.in", "r", stdin);
    freopen("shuliec.out", "w", stdout);
#endif
}

inline int get_num() {
    int k = 0, f = 1;
    char c = getchar();
    for(; !isdigit(c); c = getchar()) if(c == '-') f = -1;
    for(; isdigit(c); c = getchar()) k = k * 10 + c - '0';
    return k * f;
}

inline char get_char() {
    char c = getchar();
    for(;!isalpha(c); c = getchar());
    char k = c;
    for(; isalpha(k); k = getchar());
    return c;
}

ll sum[MAXN << 2], lz[MAXN << 2];
int n, q;

void build(int x, int l, int r) {
    if(l == r) {
        sum[x] = get_num();
    }
    else {
        int mid = (l + r) >> 1;
        build(x << 1, l, mid);
        build(x << 1 | 1, mid + 1, r);
        sum[x] = sum[x << 1] + sum[x << 1 | 1];
    }
}

inline void pushdown(int x,int l,int r) {
	if(!lz[x]) return;
    lz[x << 1] += lz[x];
    lz[x << 1 | 1] += lz[x];
    int mid = (l + r) >> 1;
    sum[x << 1] += (mid - l + 1) * lz[x];
    sum[x << 1 | 1] += (r - mid) * lz[x];
    lz[x] = 0;
}

ll find(int x, int l, int r, const int &L, const int &R) {  
    if(L <= l && r <= R) {
        return sum[x];
    }
    else {
        pushdown(x, l, r);
        int mid = (l + r) >> 1;
        ll ans = 0;
        if(L <= mid) ans += find(x << 1, l, mid, L, R);
        if(R > mid) ans += find(x << 1 | 1, mid + 1, r, L, R);
        return ans;
    }
}

void add(int x, int l, int r, const int L, const int R, const int K) {
    if(L <= l && r <= R) {
        sum[x] += (r - l + 1) * K;
        lz[x] += x;
        return;
    } 
    pushdown(x, l, r);
    int mid = (l + r) >> 1;
    if(L <= mid) add(x << 1, l, mid, L, R, K);
    if(R > mid) add(x << 1 | 1, mid + 1, r, L, R, K);
    sum[x] = sum[x << 1] + sum[x << 1 | 1];
}

int main() {
    File_Read();
    
    n = get_num();
    build(1, 1, n);
    q = get_num();
    for(int i = 1; i <= n; i++) {
        if(get_char() == 'S') {
            int l = get_num();
            int r = get_num();
            printf("%lld\n", find(1, 1, n, l, r));
        }
        else {
            int l = get_num();
            int r = get_num();
            int k = get_num();
            add(1, 1, n, l, r, k);
        }
    }
}
